package org.example.content.api;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.example.content.model.dto.SaveTeachplanDto;
import org.example.content.model.dto.TeachplanDto;
import org.example.content.service.TeachplanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Api(tags = "课程计划")
public class TeachplanController {
    @Autowired
    private TeachplanService teachplanService;
    @GetMapping("/teachplan/{courseId}/tree-nodes")
    @ApiOperation("课程计划树行查询")
    public List<TeachplanDto> getTreeNodes(@PathVariable Long courseId){
        List<TeachplanDto> teachplanTree=teachplanService.findTeachplanTree(courseId);
        return teachplanTree;
    }
    @ApiOperation("课程计划创建或修改")
    @PostMapping("/teachplan")
    public void saveTeachplan( @RequestBody SaveTeachplanDto teachplan){
        teachplanService.saveTeachplan(teachplan);
    }
}
